# 46. 字符串筛选排序

46

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});
rl.on('line', function(str) {
    rl.on('line', function(k) {
        k = parseInt(k);
        let chars = str.split('').sort();
        if (k > str.length) {
            k = str.length;
        }
        let tar = char[k - 1]
        console.log(str.indexOf(tar));
    });
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16